import BIAnalysis from "@/router/modules/BIAnalysis";// BI分析
import MemberManage from "@/router/modules/MemberManage";// 会员管理
import MarketingCenter from "@/router/modules/MarketingCenter";// 营销中心
import DownloadCenterModules from "@/router/modules/DownloadCenterModules";// 下载中心
import ParkManage from "@/router/modules/ParkManage.ts";// 停车管理
import SystemSettings from "@/router/modules/SystemSettings";// 系统管理

import { TypeRoute } from "@/interface/router";

export const routes: TypeRoute.Route[] = [
    {
        path: '/',
        name: '/',
        redirect: () => {
            const defaultName = localStorage.getItem('defaultRouterName');
            if (defaultName) {
                return {
                    name: defaultName
                }
            } else {
                return {
                    name: 'Index'
                }
            }
        }
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('@/Login/index.vue'),
        meta: {
            name: '登录',
        },
    },
    {
        path: '/index',
        name: 'Index',
        redirect: '/chooseMall',
        component: () => import('@/Layout/index.vue'),
        children: [
            {
                path: '/chooseMall',
                name: 'ChooseMall',
                component: () => import('@/views/ChooseMall/index.vue'),
                meta: {
                    name: '选择商场',
                    noUpdateApi: true,// 刷新页面不更新全局接口
                    hideMenus: true,// 头部导航栏：true隐藏 其他显示
                    showCompanyName: true,// 头部导航栏 显示集团名称
                },
            },
            ...BIAnalysis,// BI分析
            ...MemberManage,// 会员管理
            ...MarketingCenter,// 营销中心
            ...DownloadCenterModules,// 下载中心
            ...ParkManage,// 停车管理
            ...SystemSettings,// 系统管理
        ]
    },
    {
        path: "/:pathMatch(.*)*",
        name: '',
        redirect: '/404',
    },
    {
        path: '/404',
        name: '404',
        component: () => import('@/Error/404.vue'),
    },
];